<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layuiAdmin 网站用户 iframe 框</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/Font-Awesome-master/css/font-awesome.min.css">
    <script src="/js/jquery-2.1.1.min.js"></script>
    <script src="/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
    <style>
        html{
            background-color: #fff;
        }
        .layui-form-label{
            width: 120px;
        }
        #save{
            margin-top: 50px;
            margin-left: 70px;
            margin-bottom: 50px;
        }
    </style>
</head>
<body>
<div style="padding: 20px;">
    <div class="layui-form-item page-row ">
        <label class="layui-form-label flex-col-md-3">完成每局获得积分</label>
        <div class="layui-input-inline flex-col-md-7">
            <input type="text" id="a" value="{$data.0.num}"  autocomplete="off"
            class="layui-input">
        </div>
    </div>
    <div class="layui-form-item page-row ">
        <label class="layui-form-label flex-col-md-3">被评为MVP</label>
        <div class="layui-input-inline flex-col-md-7">
            <input type="text" id="b" value="{$data.1.num}"  autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item page-row">
        <label class="layui-form-label flex-col-md-3">积分兑换介绍</label>
        <div class="layui-input-block" style="width: 70%;margin-left: 150px;">
            <script id="content_content"  type="text/plain">{$jf.value|raw}</script>
            <textarea name="c" id="content_val_content" style="display: none;">{$jf.value}</textarea>
        </div>
    </div>
    <button type="button" class="layui-btn" id="save">保存</button>
</div>
<!-- 配置文件 -->
<script type="text/javascript" src="/plug/UEditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/plug/UEditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">

    UE.getEditor('content_content',{
        initialFrameHeight:400
    }).ready(function() {
        UE.getEditor('content_content').addListener('contentChange',function(){
            var html = UE.getEditor('content_content').getContent();
            console.log(html,999);
            $("#content_val_content").val(html);
        })
    });

</script>
<script>

    layui.config({
        base: '/layuiAdmin/dist/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form', 'upload','layer','laydate'], function () {
        var $ = layui.$
            , form = layui.form
            , laydate = layui.laydate
            , upload = layui.upload;
        $("#save").click(function(){
            var a = $("#a").val();
            var b = $("#b").val();
            var c= $("#content_val_content").val();
            $.ajax({
                url:"{:url('save')}",
                method:'POST',
                data:{a,b,c},
                success:function(res){
                    if (res.code == 200) {
                        layer.msg('保存成功', {
                            time: 1500 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {;
                        });
                    } else {
                        layer.msg(res.message);
                    }
                }
            })
        })
        //自定义验证
        form.verify({
            nickname: function(value, item){ //value：表单的值、item：表单的DOM对象
                if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
                    return '用户名不能有特殊字符';
                }
                if(/(^\_)|(\__)|(\_+$)/.test(value)){
                    return '用户名首尾不能出现下划线\'_\'';
                }
                if(/^\d+\d+\d$/.test(value)){
                    return '用户名不能全为数字';
                }
            }
            ,fd_number:[/^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,'只支持2位小数的数字']
            ,pass: [
                /^[\S]{6,12}$/
                ,'密码必须6到12位，且不能出现空格'
            ]

            //确认密码
            ,repass: function(value){
                if(value !== $('#LAY_password').val()){
                    return '两次密码输入不一致';
                }
            }
        });
        $('body').on('keyup', '.icon_search_input', function(){
            var keyword  = $.trim($(this).val());
            if (!keyword) {
                $(this).closest('.icon_select_options').find('li').show();
            } else {
                $(this).closest('.icon_select_options').find('li').each(function(){
                    var className = $(this).find('i').attr('class');
                    if (className.indexOf(keyword) >=0) {
                        $(this).show()
                    } else {
                        $(this).hide()
                    }
                })
            }
        })

    })
</script>
</body>
</html>